import argparse
import os
from pathlib import Path
from .openanno import OpenAnno


def main():
    parser = argparse.ArgumentParser(description="OpenAnno SNV")
    parser.add_argument("-i", "--input", required=True, type=Path, help="input, VCF file, required")
    parser.add_argument("-o", "--output", required=True, type=Path, help="output, VCF file, required")
    parser.add_argument("-G", "--genome", type=Path, help="input, genome FASTA file, required")
    parser.add_argument("-g", "--genepred", type=Path, help="input, GenePred file")
    parser.add_argument("-n", "--gene_id", type=Path, help="input, GeneID file")
    parser.add_argument("-c", "--custom", type=Path, help="input, gene based custom JSON file")
    parser.add_argument("-f", "--filter_based", nargs="+", type=Path, default=[], help="input, filter based VCF file of SNP/INDEL")
    parser.add_argument("-F", "--filter_based_dir", nargs="+", type=Path, default=[], help="input, filter based VCF file of SNP/INDEL")
    parser.add_argument("-r", "--region_based", nargs="+", type=Path, default=[], help="input, region based VCF file")
    parser.add_argument("-C", "--chrom", nargs="+", default=[f"chr{i}" for i in list(range(1, 23)) + ["X", "Y", "M"]], help="parameter, chromosomes")
    parser.add_argument("-p", "--process", type=int, default=os.cpu_count(), help=f"parameter, process number, default: {os.cpu_count()}")
    parser.set_defaults(func=lambda args: OpenAnno.model_validate(vars(args)).run())
    args = parser.parse_args()
    args.func(args)
